﻿{include file=header.html}
<script language="javascript" type="text/javascript" src="{res file=js/jquery-1.2.6.js}"></script>
<script language="javascript" type="text/javascript" src="{lib file=jquery.plugins/jquery.validate.js}"></script>
<script type="text/javascript">
$(function(){
		jQuery.validator.addMethod("check_tel", function(value, element) { 
			var tel = /^((0?1[3458]\d{9})|((0(10|2[0-3]|[3-9]\d{2}))?[1-9]\d{6,7}))$/; 
			return this.optional(element) || (tel.test(value)); 
		}, "电话号码格式错误");
     $('#company_form').validate({
        onkeyup : false,
		onfocusout : false,
		rules : {
			company_name: {
				required: true,
				remote: 'index.php?app=company&act=check_company&company_name=' + $('#company_name').val() + '{if $smarty.get.act eq 'edit'}&id={$smarty.get.company_id}{/if}'
			},
			company_address : {
				maxlength: 100
			},
			tel : {
				check_tel : true
			}
		},
		messages : {
			company_name: {
				required: '{$lang.company_name_not_empty}',
				remote: '{$lang.company_name_is_exist}'
			},
			company_address : {
				maxlength: '{$lang.address_length_error}'
			},
			tel : {
				check_tel : '{$lang.tel_error}'
			}
		}
	});
});
</script>
<style>
label.error {margin-left:2em; color:#FF0000;}
.tab-frame{width:700px;}
input[type='checkbox']{ vertical-align:middle;
margin-right:5px;}

</style>
<body>
<div class="sub-body">
<div class="tab-frame">
<div class="tab-title-1">
<!--{if $smarty.get.act eq 'add'}--><span>{$lang.add_new_company}</span><!--{else}--><span>{$lang.edit_company}</span><!--{/if}-->
</div>
<form action="{url app=company&act=$smarty.get.act}{if $smarty.get.company_id}&amp;company_id={$smarty.get.company_id}{/if}" method="post" id="company_form">
<table width="100%" cellspacing="0" cellpadding="0" class="tab-display">
	<tr>
		<th width="100" align="right">{$lang.company_name}：</th>
		<td align="left"><input type="text" name="company_name" id="company_name" value="{$company.company_name|escape}" class="input-7" /></td>
	</tr>
	<tr>
		<th width="100" align="right">{$lang.eng_company_name}：</th>
		<td align="left"><input type="text" name="eng_company_name" id="eng_company_name" value="{$company.eng_company_name|escape}" class="input-7" /></td>
	</tr>
	<tr>
		<th width="100" align="right">{$lang.company_address}：</th>
		<td align="left"><input type="text" name="company_address" id="company_address" value="{$company.company_address|escape}" class="input-7" /></td>
	</tr>
	<tr>
		<th width="100" align="right">{$lang.company_site}：</th>
		<td align="left"><input type="text" name="company_site" id="company_site" value="{$company.company_site|escape}" class="input-7" /></td>
	</tr>
	<tr>
		<th width="100" align="right">{$lang.tel}：</th>
		<td align="left"><input type="text" name="tel" id="tel" value="{$company.tel|escape}" class="input-2" /></td>
	</tr>
	<tr>
		<th width="100" align="right">{$lang.fax}：</th>
		<td align="left"><input type="text" name="fax" id="fax" value="{$company.fax|escape}" class="input-2" /></td>
	</tr>
	<tr>
		<th width="100" align="right">主管：</th>
		<td align="left">
        {foreach from=$member_list item=member}
        <label><input {if $member.is_select}checked{/if} name="uid[]" type="checkbox" value="{$member.user_id}" />{$member.user_name}</label>
        {/foreach}
        </td>
	</tr>
	<tr>
		<td colspan="2" align="center"><input type="submit" value="{$lang.submit}" class="btn-2"/></td>
	</tr>
</table>
</form>
<script language="javascript" type="text/javascript" src="{res file=js/tab_color.js}"></script>
</div>
</div>
</body>
</html>